package com.itheima.chapter07.array;

//1-100的和
public class Factorial {
    public static void main(String[] args) {
        int sum = addsum(100);
        System.out.println(sum);
    }

    private static int addsum(int i) {
        if (i == 1) {
            return 1;
        } else {
            return i + addsum(i - 1);
        }
    }
}
